import { createElement, render, renderDOM, } from './element';
import './diff'
{/* 
  树 递归 最后节点为文本时，就退出
  相同的操作，1.创建节点 2.设置属性 3. 子节点
  <ul class="list">
        <li class="item">白敬亭</li>
        <li class="item">亭</li>
</ul> 
*/}
// DOM树
let virtualDOM = createElement('ul', {
  class: 'list',
}, [createElement('li', { class: 'item' }, ['白敬亭']), createElement('li', { class: 'item' }, ['亭'])]);

// console.log(virtualDOM);
let el = render(virtualDOM);
console.log(el, '-------')

let virtualDOM2 = createElement('ul', {
  class: 'list-group'
}, [
  createElement('li', { class: 'item active' }, ['七里香']),
  createElement('li', { class: 'item ' }, ['一千年以后']),
  createElement('li', { class: 'item ' }, ['稻香'])
])

renderDOM(el, document.getElementById('root'))
// 补丁
let patches = diff(virtualDOM,virtualDOM);
console.log(pathes);